package com.tiancheng.trade.commom.core.exception.error;

import com.tiancheng.trade.commom.core.exception.assertion.BusinessExceptionAssert;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 业务错误码
 *
 * @author kellen
 * @date 2024/1/3
 */
@Getter
@AllArgsConstructor
public enum BusinessErrorInfoEnum implements BusinessExceptionAssert {
    SYSTEM_ERROR(500,"系统异常！{0}"),

    // -----------------------------------------------订单中心----------------------------------
    ORDER_NO_EXIST(1000, "订单不存在"),
    ORDER_CREATE_REPEAT(1001, "重复下单"),
    ORDER_CREATE_ORIGINAL(1002, "源订单有误"),
    ORDER_CREATE_SOURCE(1003, "订单业务渠道来源有误"),
    ORDER_CREATE_COUPON_LOCK(1004, "优惠券锁定有误"),
    ORDER_CREATE_CHANNEL_ERROR(1005, "获取订单支付渠道错误"),
    ORDER_CREATE_CHANNEL_DIFF(1006, "订单商品的支付渠道不同"),
    ORDER_CREATE_CHANNEL_UN_SUPPORT_COUPON(1007, "该商户暂不支持优惠券"),
    ORDER_CREATE_BUSINESS_TYPE_EMPTY(1008, "业务类型不允许为空"),
    ORDER_CREATE_UNKNOWN_SYSTEM(1009, "未知的系统标识"),
    ORDER_USER_NOT_AUTH(1010, "uid不能为空"),
    ORDER_CREATE_MOBILE_NUN(1011, "手机号不能为空"),
    ORDER_COUPON_UNLOCK(1012, "订单优惠券解锁失败"),
    ORDER_VIP_CHECK_ERROR(1013, "订单会员优惠校验失败"),
    ORDER_VIP_DISCOUNT_ERROR(1014, "订单会员折扣已变更,提交的会员折扣与会员当前折扣不一致"),
    ORDER_VIP_DISCOUNT_COMPOSITION_ERROR(1015, "金额抵扣不允许和优惠券、会员折扣、云币公用！"),
    ORDER_DEDUCTION_AMOUNT_ERROR(1016, "金额抵扣必须和订单金额一致！"),
    ORDER_DEDUCTION_PAY_CHECK_ERROR(1017, "0元抵扣订单支付校验失败！"),
    ORDER_CREATE_BATCH_CHECK_ERROR(1018, "创建订单失败，批次校验失败（提交的订单数量异常）！"),
    ORDER_CREATE_ORDER_ID_ERROR(1019, "创建订单失败，订单号规则异常，请检查！"),
    ORDER_CREATE_APPLICATION_ERROR(1020, "创建订单失败，应用配置异常！"),
    ORDER_CREATE_NOT_SUPPORT_COUPON_ERROR(1021, "创建订单失败，暂不支持使用优惠券！"),

    ORDER_CASHIER_STATUS(1101, "初始化收银台，订单不存在或者状态不正确"),
    ORDER_CASHIER_CHANNEL_DIFF(1102, "初始化收银台，订单支付渠道不同"),
    ORDER_CASHIER_PAY_WAY_FAIL(1103, "获取支付方式失败"),
    ORDER_CASHIER_PAY_WAY_EMPTY(1104, "未获取到相应的支付方式"),
    ORDER_CASHIER_COUPON_ONE(1105, "订单优惠券只允许绑定一张"),
    ORDER_CASHIER_MERGE_COUPON(1106, "合单支付，不允许使用优惠券"),
    ORDER_CASHIER_MERGE_NOT_SUPPORT(1107, "合单支付，不允许合并的订单类型（批次单和普通单不允许一起付款）"),

    ORDER_PAY_STATUS(1201, "支付订单，状态不正确"),
    ORDER_PAY_TIMEOUT(1202, "支付订单超时，请稍后重试"),
    ORDER_PAY_TIMEOUT_CLOSE(1203, "支付时间超时，已关闭"),
    ORDER_PAY_CHANNEL(1204, "支付订单，禁止跨渠道"),
    ORDER_PAY_SERVER_ERROR(1205, "调用支付中心失败：{0}"),
    ORDER_PAY_EMPTY(1206, "支付订单，未查询到有效订单数据"),
    ORDER_PAY_USER_ERROR(1207, "创建订单与支付订单不是同一用户"),
    CHANNEL_NO_MATCH(1208, "支付渠道未匹配"),
    ORDER_NO_PAY(1209, "订单还未确认支付"),
    ORDER_PAY_NOT_SUPPORT_PAY_WAY(1210, "支付订单，不支持的支付方式"),
    ORDER_PAY_NOT_SUPPORT_PAY_SCENE(1211, "支付订单，不支持的支付场景"),
    ORDER_PAY_DUPLICATE_PAYMENT_ERROR(1212, "支付订单，不允许重复支付"),
    ORDER_PAY_NOT_ALLOW_ORDER_TYPE_ERROR(1213, "支付订单，不允许支付的订单类型"),
    ORDER_PAY_NOT_ALLOW_MERGE_ERROR(1214, "支付订单，不允许合并支付的订单类型"),
    ORDER_PAY_NOT_ALLOW_PART_MERGE_ERROR(1215, "支付订单，不允许同批次订单部分合并支付"),
    ORDER_PAY_OTHER_ERROR(1216, "拉起支付异常，{0}"),

    ORDER_PAY_NOTIFY_NO_PAYMENT(1301, "支付回调，订单缺少提交的支付参数"),
    ORDER_PAY_NOTIFY_NO_LOCK(1302, "支付回调，获取锁失败"),
    ORDER_PAY_NOTIFY_ERROR(1303, "支付回调，处理失败"),
    ORDER_PAY_NOTIFY_NO_DATA(1304, "支付回调，未查询到订单"),

    ORDER_REFUND_REPETITION(1401, "重复退款"),
    ORDER_REFUND_TIMEOUT(1402, "订单退款超时，请稍后重试"),
    ORDER_REFUND_STATUS_ERROR(1403, "订单状态不正确，不能退款"),
    ORDER_REFUND_NO_DATA(1404, "退款，未查询到订单"),
    ORDER_REFUND_SERVER_ERROR(1405, "调用支付中心退款失败:{0}"),
    ORDER_REFUND_AMOUNT_DIFF(1406, "退款结果金额不正确"),
    ORDER_REFUND_PAY_FLOW_DIFF(1407, "不允许跨支付流水退款"),
    ORDER_REFUND_AMOUNT_SHORT(1408, "退款金额不足"),
    ORDER_REFUND_BATCH_DETAIL_DIFF(1409, "退款明细与批次不一致"),
    ORDER_REFUND_PHP_SYSTEM_ERROR(1410, "兼容老订单中心退款失败"),
    ORDER_REFUND_REPEAT_NOTICE(1411, "退款成功结果重复回调"),

    ORDER_CLOSE_NO_DATA(1501, "关闭订单，未查询到订单"),
    ORDER_CLOSE_STATUS_ERROR(1502, "状态不正确，不允许关闭！"),
    ORDER_CLOSE_REFUSE(1503, "订单支付中，不允许关闭！"),
    ORDER_PAID_REFUSE(1504, "订单已支付，不允许关闭！"),

    ORDER_STATUS_FLOW_NO_DATA(1601, "状态流转，未查询到订单或对应的状态"),
    ORDER_STATUS_FLOW_VERIFICATION_ERROR(1602, "状态流转，核销失败"),
    ORDER_STATUS_FLOW_TIMEOUT_ERROR(1603, "状态流转，执行超时"),

    ORDER_UPDATE_STATUS_ERROR(1701, "只有待支付状态订单允许修改"),
    ORDER_UPDATE_SUB_ORDER_NO(1702, "未查询到相关子订单"),

    ORDER_CREDIT_NO_EXIST(1800, "信用订单不存在"),
    ORDER_CREDIT_FREEZE_NO_EXIST(1801, "信用订单不存在冻结记录"),
    ORDER_CREDIT_UNFREEZE_STATE_ERROR(1802, "该订单状态不允许解冻"),
    ORDER_CREDIT_FREEZE_CANCEL_STATE_ERROR(1803, "该订单状态不允许撤销"),
    ORDER_CREDIT_QUERY_OLD_SYSTEM_ERROR(1804, "调用老系统信用免押订单异常"),
    ORDER_CREDIT_CREDIT_ORDER_NO_EXIST(1805, "不支持的信用类型"),
    ORDER_CREDIT_DEPOSIT_AMOUNT_ERROR(1806, "信用免押金额错误"),
    ORDER_CREDIT_UNFREEZE_ERROR(1807, "信用免押授权解冻异常"),

    BANK_CARD_BINDING_TIMEOUT(1900, "绑定银行卡超时"),
    BANK_CARD_BINDING_ERROR(1901, "请求绑定银行卡失败"),
    BANK_CARD_BINDING_FLOW_NON_EXISTENT(1902, "未查询到绑卡申请"),
    BANK_CARD_BINDING_ARGS_ERROR(1903, "查询银联绑卡状态异常，缺少参数"),
    BANK_CARD_BINDING_CALLBACK_NOT_ORDER(1904, "银联绑卡回调，为查询到绑卡记录"),
    BANK_CARD_BINDING_CALLBACK_REPEAT(1905, "银联绑卡回调，重复回调"),
    BANK_CARD_BINDING_BOUND_BY_OTHERS(1906, "银联绑卡绑定异常，卡已被其他人绑定"),
    BANK_CARD_BINDING_REPEAT_BOUND_ERROR(1907, "该卡片已绑定成功，请勿重复绑定"),
    BANK_CARD_BINDING_STATUS_ERROR(1908, "银行卡状态异常"),
    BANK_CARD_BINDING_CARD_NON_EXISTENT(1909, "未查询到银行卡"),
    BANK_CARD_UNBOUND_ERROR(1910, "银行卡解除绑定异常"),
    BANK_CARD_QUERY_BANK_LIST_ERROR(1911, "获取银联银行卡列表异常"),
    BANK_CARD_UNBOUND_ON_CODE_ERROR(1912, "解绑一卡通失败，请重试"),
    BANK_CARD_NO_ORDER(1913, "未查询到订单"),
    BANK_CARD_QUERY_USER_INFO_ERROR(1914, "获取用户信息异常"),
    BANK_CARD_QUERY_USER_CODE_ERROR(1915, "请先绑定一码通"),


    OLD_ORDER_CAN_NOT_PAY(2000, "订单无法支付"),

    ORDER_INVOICE_NO_DATA(2100, "未查询到可开票订单信息"),
    ORDER_INVOICE_REFUND_RED_FAIL(2101, "订单退款冲红失败:{0}"),
    ORDER_INVOICE_RESET_FAIL(2102, "重新开具发票失败"),
    ORDER_INVOICE_DUP(2103, "重复开票"),

    //英文版错误提示
    EN_ORDER_PAY_STATUS(2200, "Payment order, status incorrect"),
    EN_ORDER_PAY_TIMEOUT(2201, "Payment timeout, please try again later"),
    EN_ORDER_PAY_TIMEOUT_CLOSE(2202, "Payment timeout, the order is closed"),
    EN_ORDER_PAY_CHANNEL(2203, "Payment order, cross channel prohibited"),
    EN_ORDER_PAY_SERVER_ERROR(2204, "Failed to call payment center"),
    EN_ORDER_NO_EXIST(2205, "Order does not exist"),
    EN_ORDER_CASHIER_STATUS(2206, "Initialize cashier, the order does not exist or the status is incorrect"),
    EN_ORDER_CASHIER_CHANNEL_DIFF(2207, "Initialize cashier，the payment channel is different"),
    REPORT_REPEAT_RECORD(2208, "重复添加"),
    REPORT_UNKNOWN_CHANNEL(2209, "未知的渠道"),
    REPORT_USER_CACHE_NULL(2210, "无用户上报缓存"),
    REPORT_PAGE_NOT_MATCH(2211, "用户页面路径不匹配"),

    // -----------------------------------------------商户中心----------------------------------
    PRODUCT_EXISTS_ERROR(3000, "商品编码已存在"),
    PRODUCT_BUSINESS_EXISTS_ERROR(3001, "业务商品编码已存在"),
    PRODUCT_OR_MERCHANT_NOT_EXISTS_ERROR(3002, "商户或商品不存在"),
    MERCHANT_REG_ID_PHOTO_TYPE_ERROR(3010, "商户进件异常，不支持的证件照类型"),
    MERCHANT_REG_BUSINESS_ERROR(3011, "商户进件异常，查询业务异常"),
    MERCHANT_REG_ID_PHOTO_ALREADY_EXISTS_ERROR(3012, "商户进件异常，该商户证件照类型图片已存在！"),
    MERCHANT_REG_ID_PHOTO_SIZE_ERROR(3013, "商户进件异常，上传证件大小超限制！"),
    MERCHANT_REG_ID_PHOTO_UNKNOWN_ERROR(3014, "商户进件异常，上传证件照片异常！"),
    MERCHANT_REG_COMPLEX_UPLOAD_ERROR(3015, "商户进件异常，提交详细资料失败！"),
    MERCHANT_REG_ERROR(3020, "商户进件异常，{}！"),

    SETTLE_RULE_RULE_ORDER_SOURCE_NOT_SUPPORT(3024, "当前场景不开放导入清分规则能力"),
    SETTLE_RULE_RULE_DELETE_FAIL(3028, "删除清分规则失败，请重试"),
    MERCHANT_NOT_EXISTENCE(3030,"商户不存在"),




    //------------------------------------------------- 支付中心

    CHANNEL_NO_PAY_WAY(4000, "支付方式未匹配"),
    CHANNEL_NO_FLOW(4001, "未查询到相应流水"),
    CHANNEL_NO_PAY_SCENE(4002, "支付场景未匹配"),
    CHANNEL_CLOSE(4003, "当前支付通道已关闭支付能力"),

    CHANNEL_PAY_DUP(4004, "支付重复提交"),
    CHANNEL_PAY_FAIL(4005, "支付失败:{0}"),
    CHANNEL_PAY_FAIL_SIGN_ERROR(4005, "支付失败,签名异常"),
    CHANNEL_CREATE_PAY_FAIL(4007, "创建支付失败"),

    CHANNEL_REFUND_FAIL(4008, "退款失败"),
    CHANNEL_REFUND_NO_PAY(4010, "未支付成功，不能退款"),
    CHANNEL_REFUND_AMOUNT_OUT(4011, "退款总金额超出支付金额"),
    CHANNEL_REFUND_FAIL_PARAMS_ERROR(4012, "退款失败，参数错误"),
    CHANNEL_REFUND_FAIL_AMOUNT_ERROR(4013, "退款失败，金额校验失败"),
    CHANNEL_REFUND_FAIL_DAYMAXREFUNDAMOUNT_OVER(4014, "退款失败，商户退款超当日限额"),
    CHANNEL_REFUND_FAIL_NOT_SUPPORT_DEDUCTION_REFUND(4015, "退款失败，该订单不支持抵扣退款"),
    CHANNEL_REFUND_FAIL_PAYMENT_ID_EXIST(4016, "退款失败，退款单号重复"),

    CHANNEL_CLOSE_STATUS_ERROR(4020, "状态不正确，不允许关闭"),
    CHANNEL_CLOSE_PAID_ERROR(4021, "状态不正确，订单已支付，不允许关闭"),

    CHANNEL_VERIFICATION_STATUS_ERROR(4030, "状态不正确，不允许核销"),

    CHANNEL_CALLBACK_PAY_ERROR(4031, "支付回调处理失败"),
    CHANNEL_CALLBACK_PAY_DUP(4032, "支付回调重复"),
    CHANNEL_CALLBACK_PAY_NO_FLOW(4033, "支付回调，未查询到支付流水"),
    CHANNEL_CALLBACK_PAY_AMOUNT_DIFF(4034, "支付回调，与渠道返回金额不一致"),
    CHANNEL_CALLBACK_PAY_SUCCESS_DUP(4035, "已支付成功，重复回调"),
    CHANNEL_CALLBACK_PAY_UNKNOWN_STATUS(4036, "已支付成功，未知的支付状态"),

    CHANNEL_CALLBACK_REFUND_ERROR(4037, "退款回调处理失败"),
    CHANNEL_CALLBACK_REFUND_DUP(4038, "退款回调重复"),
    CHANNEL_CALLBACK_REFUND_NO_FLOW(4039, "退款回调，未查询到退款流水"),
    CHANNEL_CALLBACK_REFUND_SUCCESS_DUP(4040, "已退款成功，重复回调"),
    CHANNEL_RSUBMIT_REFUND_NO_FLOW(4041, "未查询到退款流水"),
    CHANNEL_RSUBMIT_REFUND_FLOW_STATUS_ERROR(4042, "退款流水不允许重新提交"),
    CHANNEL_QUERY_REFUND_FLOW_ERROR(4043, "查询退款流水失败"),
    CHANNEL_REFUND_TIMEOUT_FLOW_ERROR(4044, "计平退款超时，进行状态同步"),
    CHANNEL_CALLBACK_REFUND_UNKNOWN_STATUS(4045, "退款状态未知"),

    CHANNEL_SIGN_FAIL(4050, "支付渠道签名失败"),
    UMS_CHANNEL_SIGN_FAIL(4051, "银联渠道签名失败"),

    CHANNEL_PAY_NO_MERCHANT(4052, "商户未进件"),
    CHANNEL_PAY_NO_RULE(4053, "订单商品缺少清分规则"),
    CHANNEL_PAY_RULE_ERROR(4054, "清分规则异常"),
    CHANNEL_PAY_SETTLE_ERROR(4055, "清分规则结算类型异常"),

    UMS_SETTLE_ERROR(4056, "银联清分异常"),
    UMS_COUPON_SETTLE_ERROR(4056, "不支持的优惠清分类型"),

    MESSAGE_SEND_ERROR(4057, "回调消息推送异常"),

    ASSET_MANAGEMENT_NOT_FOUNT_APPROPRIATIONS_FILE(4060, "未查询到划付记录"),
    ASSET_MANAGEMENT_UPDATE_APPROPRIATIONS_ERROR(4061, "划付回盘跟新划付记录异常"),
    ASSET_MANAGEMENT_NOT_SUPPORT_CHANNEL(4062, "不支持的文件操作类型"),
    ASSET_MANAGEMENT_FILE_CHECK_ERROR(4063,"优惠清分回盘文件校验失败"),

    PAYMENT_CHANNEL_ADD_ERROR(4070, "添加支付渠道失败"),
    PAYMENT_CHANNEL_UPDATE_ERROR(4071, "修改支付渠道失败"),
    PAYMENT_CHANNEL_FIND_ERROR(4072, "获取支付渠道失败"),
    PAYMENT_CHANNEL_ADD_EXIST_ERROR(4073, "添加支付渠道失败，当前渠道已经存在，请检查"),
    PAYMENT_ORDER_ADD_ERROR(4074, "添加支付订单失败"),
    PAYMENT_ORDER_UPDATE_ERROR(4075, "修改支付订单失败"),
    PAYMENT_ORDER_FIND_ERROR(4076, "获取支付订单失败"),
    PAYMENT_ORDER_ORG_PAY_CHANNEL_ERROR(4078, "获取平台支付渠道信息异常"),
    ;


    /**
     * 返回码
     */
    private int code;
    /**
     * 返回消息
     */
    private String message;
}
